//
//  MSFilterMultipleTableVC.m
//  SocietySale
//
//  Created by Mike on 16/11/15.
//  Copyright © 2016年 Mike. All rights reserved.
//

#import "MSFilterMultipleTableVC.h"

@interface MSFilterMultipleTableVC ()

@end

@implementation MSFilterMultipleTableVC

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *cellId = @"cellId";
    MSFilterMultipleCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (!cell) {
        cell = [[MSFilterMultipleCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellId];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    cell.valueStr = self.dataArray[indexPath.row];
    cell.tagImage.hidden = [self.stateArray[indexPath.row] isEqualToString:@"NO"];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 40;
}

@end


@interface MSFilterMultipleCell ()
@property (nonatomic, strong) UILabel *titleLabel;
@end

@implementation MSFilterMultipleCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initView];
    }
    return self;
}

- (void)initView{
    self.titleLabel = [self creatLabel:CGRectMake(0, 0, SCREEN_WIDTH, 40)];
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    
    _tagImage = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2+75, 15, 18, 11)];
    _tagImage.image = [UIImage imageNamed:@"gou"];
    [self.contentView addSubview:_tagImage];
    _tagImage.hidden = YES;
    
    UIView *horizonLineView =[[UIView alloc] initWithFrame:CGRectMake(12, 40-0.6, SCREEN_WIDTH-24, 0.6)];
    horizonLineView.backgroundColor = kNormalGray;
    [self.contentView addSubview:horizonLineView];
}

//创建label
- (UILabel*)creatLabel:(CGRect)frame{
    UILabel *label = [[UILabel alloc] initWithFrame:frame];
    label.font = HeitiFont(15);
    label.textColor = kLightBlackColor;
    [self.contentView addSubview:label];
    return label;
}

- (void)setValueStr:(NSString *)valueStr{
    self.titleLabel.text = valueStr;
}

@end
